package edu.mtu.citizenscience.mushroommapper.activity.main.find;

import com.androidquery.AQuery;

import edu.mtu.citizenscience.mushroommapper.activity.R;

import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
 * @author Corbin Uselton <corbinu@cwuselto@mtu.edu>
 * @copyright (c) 2012 MichiganTech <http://www.mtu.edu>
 * @since 1.0
 * 
 * Dialog for informing the user that the app is currently trying to get the GPS location
 */
public class LocationDialog extends DialogFragment {
	// android-query library
	private AQuery aq;

	/**
	 * Find Activity creation handler
	 * 
	 * @param   void
	 * @return	void
	 */
	@Override
    public void onCreate(Bundle savedInstanceState) 
	{
        super.onCreate(savedInstanceState);
        
        // remove the title bar from this dialog
        this.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
    }
	
	/**
	 * Create view for the location Dialog
	 * 
	 * @param inflater - LayoutInflater - for inflating views
	 * @param container - ViewGroup - the dialogs view container
	 * @param savedInstanceState - Bundle - Bundle with launch info
	 * @return View - the View for the fragment's UI, or null
	 */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
    {
    	// inflate the progress dialog view
    	View view = inflater.inflate(R.layout.dialog_location, container, false);
    	
    	// create instance of the AQuery instance for this view
    	this.aq = new AQuery(this.getActivity(), view);
    	
    	// set the dialog title to getting location
    	this.getDialog().setTitle("Getting location...");
    	
    	// set the cancel button click handler to the saveWithoutClicked function the parent activity
    	this.aq.id(R.id.locationCancelButton).clicked(this.getActivity(), "saveWithoutClicked");
    	
    	 // return the inflated view
        return view;
    }

}
